package com.knife.controller;

import com.knife.entity.UserVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author syf
 * @create 2022-05-07 15:36
 */
@RestController
@Api("控制器")
public class controller {

    @ApiOperation("添加")
    @PostMapping("/add")
    public UserVO add(@RequestBody UserVO userVO) {
        // 将数据写到数据库
        userVO.setId(1);
        userVO.setAge(2);
        userVO.setUsername("hh");
        return userVO;
    }

    @ApiOperation("修改")
    @PostMapping("/edit")
    public UserVO edit(@RequestBody UserVO userVO) {
        // 修改数据库的数据
        userVO.setId(1);
        userVO.setAge(2);
        userVO.setUsername("hh");
        return userVO;
    }

    @ApiOperation("查找")
    @GetMapping("/find")
    public List<UserVO> find(UserVO userVO) {
        return new ArrayList<>();
    }

    @ApiOperation("删除")
    @PostMapping("/delete")
    public void delete(Long id) {
        // 将数据库数据删除
    }
}
